Improve test coverage to ~100% for @azure/core-lro#38178
Merged
deyaaeldeen merged 37 commits intomainfrom Apr 21, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Split poller-poller.spec.ts: - test/public/poller.spec.ts: 12 tests using createTestPoller/createHttpPoller - test/internal/poller-poller.spec.ts: 7 tests using internal helpers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deduplicate makeRawResponse (5 files) and makeState (4 files) into test/utils/utils.ts. All 347 tests pass with build-test clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move 5 tests that only use createTestPoller (public API) from test/internal/poller-operation.spec.ts to test/public/poller.spec.ts. Internal file retains 6 tests that use internal APIs (deserializeState, pollOperation, initOperation, buildCreatePoller). All 347 tests pass with build-test clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- poller-poller.spec.ts → buildCreatePoller.spec.ts - poller-operation.spec.ts → pollerInternals.spec.ts - http-poller.spec.ts → pollHttpOperation.spec.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the @azure/core-lro test suite with additional internal and public tests to drive overall coverage toward ~100%, including new tests around poller internals, HTTP operation behavior, and additional rewriteUrl error-path coverage.
Changes:
- Added new internal unit tests for poller internals (
buildCreatePoller,pollOperation, state-guard behavior) and HTTP operation helpers. - Extended public LRO tests to exercise additional
createHttpPollerbehaviors (operation-location callbacks, resolve-on-unsuccessful paths, error formatting). - Extended
rewriteUrltests to cover invalid base URL / relative URL resolution error handling.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/core/core-lro/test/utils/utils.ts | Adds shared test helpers for constructing RawResponse and operation state objects. |
| sdk/core/core-lro/test/public/lro.spec.ts | Adds a large createHttpPoller test suite covering additional polling and error scenarios. |
| sdk/core/core-lro/test/internal/rewriteUrl.spec.ts | Adds an additional negative test for rewriteUrl error handling. |
| sdk/core/core-lro/test/internal/pollerInternals.spec.ts | Introduces tests for poller operation internals (deserializeState, pollOperation, initOperation). |
| sdk/core/core-lro/test/internal/poller-state-guard.spec.ts | Adds tests for defensive “state must be initialized” guards in the poller. |
| sdk/core/core-lro/test/internal/pollHttpOperation.spec.ts | Adds a focused test for pollHttpOperation default processResult behavior. |
| sdk/core/core-lro/test/internal/http-operation.spec.ts | Adds broad unit tests for HTTP operation helpers (mode inference, status/error parsing, retry-after handling). |
| sdk/core/core-lro/test/internal/buildCreatePoller.spec.ts | Adds tests for Body/ResourceLocation status handling and a polling interval path. |
- Remove brittle line numbers from test names in poller-state-guard - Rename misleading isDone describe block in pollerInternals - Rename setDelay test to match actual behavior in buildCreatePoller - Use non-zero retry-after value (1) to properly exercise setDelay branch - Run format Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
deyaaeldeen
pushed a commit
that referenced
this pull request
Apr 17, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ientHelpers tests The find() callback already matches by policy name, so asserting strictEqual on .name after isDefined is redundant. Also simplifies the assertions by inlining find() into isDefined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- serviceClient.spec.ts: Replace weak assert.isDefined with specific assertions verifying Invalid Date instance for malformed DateTime string - authorizeRequestOnTenantChallenge.spec.ts: Fix const->let for calledOnce variable so both if/else branches are exercised in mock Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…m status, and retry-after - Assert getPollingInterval callback is actually invoked (buildCreatePoller.spec.ts) - Assert getStatusFromPollResponse callback is actually invoked (pollerInternals.spec.ts) - Rename retry-after test to accurately describe smoke test behavior (lro.spec.ts) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace weak assertions with stronger alternatives - Remove redundant isDefined before deepEqual - Fix misleading test name Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jeremymeng
reviewed
Apr 21, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ing test - Fix misleading 'setErrorAsResult is true' title (was actually false) - Add state assertion to 'sets state to failed' test - Strengthen innererror chain test to verify message concatenation - Verify milliseconds scale in retry-after date test - Add 'missing code' test case for getErrorFromResponse - Replace pollCount with spy for consistency - Shorthand property nit in buildCreatePoller test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jeremymeng
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
New test files
Expanded existing tests
Test quality improvements